//
//  ABSTableviewHeaderView.m
//  商品详情
//
//  Created by 我演示 on 2019/10/24.
//  Copyright © 2019 Jerry-Fu. All rights reserved.
//

#import "ABSTableviewHeaderView.h"
#import "DetailRootBannerModel.h"


@interface ABSTableviewHeaderView ()<SDCycleScrollViewDelegate>



/**cycleView*/
@property(nonatomic,weak) SDCycleScrollView *cycleScrollerView ;


@end

@implementation ABSTableviewHeaderView



-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        [self makeUpUI];
        self.contentView.backgroundColor= UIColor.clearColor;
        
        
    }
    return self;
    
}

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame: frame]) {
    
    }
    return self;
}

-(void)makeUpUI {

    
 
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height) delegate:self  placeholderImage:[UIImage imageNamed:@"tabBar_publish_icon"]];
    cycleScrollView.currentPageDotColor = [UIColor redColor];
    cycleScrollView.backgroundColor = [UIColor redColor];


    [self.contentView addSubview:cycleScrollView];

    self.cycleScrollerView = cycleScrollView;
  
    
}

-(void)setImageModel:(DetailRootModel *)imageModel {
    
    _imageModel = imageModel ;
    
    NSMutableArray *dataArray = [NSMutableArray array];
    for (int i = 0;  i< imageModel.carouselImgs.count; i++) {
        DetailRootBannerModel  *bannerModel  = imageModel.carouselImgs[i];

        [dataArray addObject:bannerModel.img];
    }
    self.cycleScrollerView.imageURLStringsGroup = dataArray;
}
//数据model 的内容

-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
    
   NSLog(@"%ld",(long)index);
 
   
    
    
}

-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {

 
}
-(void)makeTextWritingDirectionLeftToRight:(id)sender {
    
    
    
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.cycleScrollerView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
}


@end
